home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
PASCAL
/
0391B.ZIP
/
SKLOAD.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1987-02-22
|
2KB
|
60 lines
PROGRAM SKLoad;
{Program to determine whether or not SK is loaded. Thanks to unknown author
of ACTSK.PAS for preliminary work on this concept. This program may be useful
for terminate-stay-resident programs to make sure that your user loads your
TSR before, not after, SideKick. Any questions, consult Bob Tolz,
110 Greene St., NY, NY 10012. Compuserve [70475,1071]. July 14, 1986}
FUNCTION SideKickIsLoaded : Boolean;
CONST MaxVectors = 10;
{Number of interrupts taken over by SK}
TYPE
skstr = ARRAY[1..2] OF Char;
{'SK' can be found at LabelOffset of SK's code segment.
This is not in a string form, so we need to use a
2-character array rather than a string of length 2}
VectorArray = ARRAY[1..10] OF Byte;
{Array of all interrupts taken over by SK}
skpointer = ^skstr;
VAR found : Boolean;
SKcodeseg, i : Integer;
skptr : skpointer;
{pointer to location where 'SK' ought to be found}
CONST vectors : vectorarray = ($08, $09, $10, $13, $16,
$1C, $21, $25, $26, $28);
{interrupt vectors taken over by SK. Cycle through all of them
in case a resident program is loaded after SK and takes over one
or more of the interrupts, thereby masking SK's control of that
vector.}
LabelOffset = $016C;
{offset from code segment where 'SK' should be found}
BEGIN
i := 1;
found := False;
REPEAT
SKCodeSeg := MemW[0:vectors[i]*4+2];
{SK's code segment is found at memw[0:vectors[i]*4+2]}
skptr := Ptr(SKCodeSeg, Labeloffset);
IF skptr^ = 'SK' THEN found := True;
i := i+1;
UNTIL found OR (i > maxvectors);
sidekickisloaded := found;
END; {Sidekickisloaded}
BEGIN
IF sidekickisloaded THEN WriteLn('SK loaded')
ELSE WriteLn('SK not loaded');
END.
{Sidekick